package com.demo.valuestream;

import com.demo.common.Dish;
import com.demo.common.DishUtil;

import java.util.List;
import java.util.OptionalInt;

public class TestOptionalInt {
    public static void main(String[] args) {
        List<Dish> menu = DishUtil.getDishes();
        OptionalInt macCalories = menu.stream()
                .mapToInt(Dish::getCalories)
                .max();
        int max = macCalories.orElse(1);
        System.out.println(max);
    }
}
